GtkCssDependencies *dependencies)
{
GtkCssValue *computed;
+ GtkCssDependencies child_deps;
gboolean changed = FALSE;
guint i;
- *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
-
computed = _gtk_css_border_value_new (NULL, NULL, NULL, NULL);
computed->fill = value->fill;
{
if (value->values[i])
{
- computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, NULL);
+ computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, &child_deps);
+ *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
changed |= (computed->values[i] != value->values[i]);
}
}
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
+ GtkCssDependencies x_deps, y_deps;
- *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
-
- x = _gtk_css_value_compute (corner->x, property_id, context, NULL);
- y = _gtk_css_value_compute (corner->y, property_id, context, NULL);
+ x = _gtk_css_value_compute (corner->x, property_id, context, &x_deps);
+ y = _gtk_css_value_compute (corner->y, property_id, context, &y_deps);
+ *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == corner->x && y == corner->y)
{
_gtk_css_value_unref (x);
{
GtkStyleContext *parent = gtk_style_context_get_parent (context);
- *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
-
if (parent)
- return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id));
+ {
+ *dependencies = GTK_CSS_EQUALS_PARENT;
+ return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id));
+ }
else
- return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
- property_id,
- context,
- NULL);
+ {
+ return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
+ property_id,
+ context,
+ dependencies);
+ }
}
static gboolean
break;
}
- *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
-
switch (number->unit)
{
default:
GTK_CSS_PX);
break;
case GTK_CSS_EM:
+ *dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
return _gtk_css_number_value_new (number->value *
_gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
+ *dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
return _gtk_css_number_value_new (number->value * 0.5 *
_gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100),
GTK_CSS_PX);
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
+ GtkCssDependencies x_deps, y_deps;
- x = _gtk_css_value_compute (position->x, property_id, context, NULL);
- y = _gtk_css_value_compute (position->y, property_id, context, NULL);
+ x = _gtk_css_value_compute (position->x, property_id, context, &x_deps);
+ y = _gtk_css_value_compute (position->y, property_id, context, &y_deps);
+ *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == position->x && y == position->y)
{
_gtk_css_value_unref (x);
return _gtk_css_value_ref (position);
}
- *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
-
return _gtk_css_position_value_new (x, y);
}
return gtk_css_change_translate (match, table, G_N_ELEMENTS (table));
}
+GtkCssDependencies
+_gtk_css_dependencies_union (GtkCssDependencies first,
+ GtkCssDependencies second)
+{
+ return (first & ~GTK_CSS_EQUALS_PARENT) | ((first & GTK_CSS_EQUALS_PARENT) ? GTK_CSS_DEPENDS_ON_PARENT : 0)
+ | (second & ~GTK_CSS_EQUALS_PARENT) | ((second & GTK_CSS_EQUALS_PARENT) ? GTK_CSS_DEPENDS_ON_PARENT : 0);
+}
+
GTK_CSS_MS,
} GtkCssUnit;
-GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match);
-GtkCssChange _gtk_css_change_for_child (GtkCssChange match);
+GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match);
+GtkCssChange _gtk_css_change_for_child (GtkCssChange match);
+GtkCssDependencies _gtk_css_dependencies_union (GtkCssDependencies first,
+ GtkCssDependencies second);
G_END_DECLS